/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojo;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author A7med Kotb
 */
@Entity
@Table(name = "orderdetail")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Orderdetail.findAll", query = "SELECT o FROM Orderdetail o"),
    @NamedQuery(name = "Orderdetail.findById", query = "SELECT o FROM Orderdetail o WHERE o.id = :id"),
    @NamedQuery(name = "Orderdetail.findByFoodPrice", query = "SELECT o FROM Orderdetail o WHERE o.foodPrice = :foodPrice"),
    @NamedQuery(name = "Orderdetail.findByCount", query = "SELECT o FROM Orderdetail o WHERE o.count = :count")})
public class Orderdetail implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "foodPrice")
    private BigDecimal foodPrice;
    @Column(name = "count")
    private Integer count;
    @JoinColumn(name = "userOrderId", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Userorder userOrderId;
    @JoinColumn(name = "extraPriceId", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Extraprice extraPriceId;
    @JoinColumn(name = "foodId", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Food foodId;

    public Orderdetail() {
    }

    public Orderdetail(Integer id) {
        this.id = id;
    }

    public Orderdetail(Integer id, BigDecimal foodPrice) {
        this.id = id;
        this.foodPrice = foodPrice;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigDecimal getFoodPrice() {
        return foodPrice;
    }

    public void setFoodPrice(BigDecimal foodPrice) {
        this.foodPrice = foodPrice;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Userorder getUserOrderId() {
        return userOrderId;
    }

    public void setUserOrderId(Userorder userOrderId) {
        this.userOrderId = userOrderId;
    }

    public Extraprice getExtraPriceId() {
        return extraPriceId;
    }

    public void setExtraPriceId(Extraprice extraPriceId) {
        this.extraPriceId = extraPriceId;
    }

    public Food getFoodId() {
        return foodId;
    }

    public void setFoodId(Food foodId) {
        this.foodId = foodId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Orderdetail)) {
            return false;
        }
        Orderdetail other = (Orderdetail) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojo.Orderdetail[ id=" + id + " ]";
    }
    
}
